#include "Item.h"
#include<QPixmap>
#include<QDebug>

Item::Item()
{
    this->setPixmap(QPixmap(":/bg/qt.picture/bg1.jpg") );
    this->start=false;        //图元初始化
    this->mouse=false;       //图元初始化
}
void Item::setPic(QString path)
{
    this->setPixmap(QPixmap(path));
}
void Item::mousePressEvent(QGraphicsSceneMouseEvent *event){   //鼠标点击图元

    //检验点击图元有反应
   // qDebug()<<"鼠标点击";

    //若开始
    if(this->isStart()){
        if(this->isMouse()){
            qDebug()<<"打中";
        }
        else{
            qDebug()<<"未打中";
        }
    }
}

//判断所点击的图元是否为老鼠
void Item::setMouse(bool mouse)
{
    this->mouse=mouse;
}
bool Item::isMouse()
{
    return this->mouse;
}

//判断是否是开始的游戏状态
void Item::setStart(bool start)
{
    this->start=start;
}
bool Item::isStart()
{
    return this->start;
}
